import axios from 'axios';
import { ElMessage } from 'element-plus';
import { Session } from '/@/utils/storage';

export const myUploadFile = (file: any, url: string, key: string, msg: string,fn:Object) => {
	const formData = new FormData();
	formData.append(key, file);
	axios.post(url, formData, {
			headers: {
				'X-Token': Session.get('token'),
			},
		})
		.then((res) => {
			// 上传成功后的处理
			ElMessage.success(msg);
		});
};

// 实例
//myUploadFile(file, `${state.baseUrl}/v0/system/about/license`, 'file', '上传成功，请刷新页面')
